import http from "./request.ts"
// coupon/list 根据优惠券名称和类型分页获取优惠券列表
export const getCouponList = (params: MyCouponListParams): RES<MyCouponListModel> => http.get(`/coupon/list`, { params })


// coupon/{id}获取单个优惠券的详细信息
export const getCouponListById = (id: number): RES<MyCouponListDetailModel> => http.get(`/coupon/${id}`)

// couponHistory/list 根据优惠券id，使用状态，订单编号分页获取领取记录
export const couponHistoryList = (params: CouponHistoryListParams): RES<CouponHistoryListModel> => http.get(`/couponHistory/list`, { params })

// coupon/delete/{id} 删除优惠券
export const CouponListDelete = (id: number): RES<CouponR> => http.post(`/coupon/delete/${id}`)
// /coupon/create 添加优惠券
export const ICouponCreate = (params: ICouponByIdModel): RES<CouponR> => http.post(`/coupon/create`, { params })
// coupon/update/{id} 修改优惠券
export const ICouponUpdateById = (params: MyCouponListDetailModel): RES<MyCouponListModel> => http.post(`/coupon/update/${params.id}`, params)